package com.szrt.oa.student.cotroller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.szrt.oa.student.entity.StudentEntity;
import com.szrt.oa.student.service.impl.StudentService;

@Controller
@RequestMapping("/student")
public class StudentContoller {
	
	
	
	@Autowired
	private StudentService service;
	
	
	//http://localhost:8090/ssm/student/deleteById.do?id=2
	@RequestMapping("/deleteById")
	@ResponseBody
	Map<String,Object> deleteById(StudentEntity entity){
		
		Map<String, Object> map = service.deleteById(entity);
		return map;
	}
	
	//http://localhost:8090/ssm/student/update.do?name=liuhao&age=22&registerTime=2017/1/1&id=1
	@RequestMapping("/update")
	@ResponseBody
	Map<String,Object> update(StudentEntity entity){
		Map<String, Object> map = service.update(entity);
		return map;
		
	}
	
	//http://localhost:8090/ssm/student/add.do?name=liuhao6&age=22&registerTime=2017-03-08
	@RequestMapping("/add")
	@ResponseBody
	Map<String,Object> add(StudentEntity entity){
		Map<String, Object> map = service.add(entity);
		
		return map;
	}
	
	//http://localhost:8090/ssm/student/findById.do?id=1
	@RequestMapping("/findById")
	@ResponseBody
	Map<String,Object> findById(StudentEntity entity){
		Map<String, Object> map = service.findById(entity);
		return map;
	}
	
	
	

}
